package com.roubsite.cloud.sysuser.controller;

import com.roubsite.cloud.common.bean.Result;
import com.roubsite.cloud.common.userinfo.RCUserUtils;
import com.roubsite.cloud.common.userinfo.SecurityUserDetails;
import com.roubsite.cloud.sysuser.bean.User;
import com.roubsite.cloud.sysuser.service.SysUserService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("sysuser")
public class UserController {
    @Autowired
    SysUserService sysUserService;
    @Resource
    RCUserUtils rcUserUtils;

    @RequestMapping("me")
    public Result getUsers(ServerHttpRequest serverHttpRequest) {
        SecurityUserDetails userDetails = rcUserUtils.getUserInfo(serverHttpRequest);
        User user = new User(userDetails);
        return Result.setData(user);
    }
}
